package Reaction::InterfaceModel::Action::User::Role::ConfirmationCodeSupport;

use Moose::Role;
use Digest::MD5;

sub generate_confirmation_code {
  my $self = shift;
  my $ident = $self->target_model->identity_string.
              $self->target_model->password;
  my $secret = $self->ctx->config->{confirmation_code_secret};
  die "Application config does not define confirmation_code_secret"
    unless $secret;
  return Digest::MD5::md5_hex($secret.$ident);
}

1;
